package com.css.wc;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.topology.TopologyBuilder;

/**
 * 驱动类
 */
public class WordCountTopology {
    public static void main(String[] args) {
        TopologyBuilder topologyBuilder = new TopologyBuilder();
        topologyBuilder.setSpout("readfilespout",new ReadFileSpout());
        topologyBuilder.setBolt("split",new SplitBolt()).shuffleGrouping("readfilespout");
        topologyBuilder.setBolt("count",new WordCountBolt()).shuffleGrouping("split");
        //两种提交模式，1本地；2集群
        Config config = new Config();//配置文件

        LocalCluster localCluster = new LocalCluster();
        localCluster.submitTopology("wordcount",config,topologyBuilder.createTopology());
    }
}
